package au.edu.swin.bank.ejb.session.stateless;

import au.edu.swin.bank.persistence.entity.BankTransactionDTO;
import java.math.BigInteger;
import java.util.Collection;
import javax.ejb.Remote;

/**
 *
 * @author Luke
 */
@Remote
public interface TransactionRemote
{
    /**
     * Transfers funds between two accounts.
     * @param aAmount The amount to transfer
     * @param aSrcAccountId The id of the account to transfer from
     * @param aDestAccountId The id of the account to transfer to
     * @param aDescription The description of the transfer
     * @return True if the transfer succeeds, otherwise false
     */
    boolean transferFunds(double amount, BigInteger srcAccountId, BigInteger destAccountId, String description);

    /**
     * Pays a specified amount of a bill.
     *
     * @param aAmount The amount of the bill to pay
     * @param aSrcAccountId The id of the account to pay the bill from
     * @param aBillId The id of the bill to pay
     * @param aDescription The description of the bill payment
     * @return True if the bill payment succeeds, otherwise false
     */
    boolean payBill(double amount, BigInteger srcAccountId, BigInteger destAccountId, String description);

    /**
     * Withdraws funds from an account
     * @param aAmount The amount to withdraw
     * @param aAccountId The ID of the account to withdraw from
     * @param aDescription The description of the transaction
     * @return True if the transaction succeeds, otherwise false
     */
    boolean withdrawFunds(double aAmount, BigInteger aAccountId, String aDescription);

    /**
     * Deposits funds into an account
     * @param aAmount The amount to deposit
     * @param aAccountId The ID of the account to deposit into
     * @param aDescription The description of the transaction
     * @return True if the transaction succeeds, otherwise false
     */
    boolean depositFunds(double aAmount, BigInteger aAccountId, String aDescription);

    /**
     * Gets a list of transactions for the specified account between the specified dates
     * @param aAccountId The account to get the transactions for
     * @param aStartDate The start date of the transaction period
     * @param aEndDate The end date of the transaction period
     * @return A collection of transactions
     */
    public Collection<BankTransactionDTO> getTransactions(BigInteger aAccountId, BigInteger aStartDate, BigInteger aEndDate);

    void setCustId(Integer aCustId);
    
    /**
     * Forces an eviction of the data in the Bean's cache.
     */
    public void forceEvict();
}
